<template>
  <div>
    <!--右边-->
    <div class="h-27">
      <div class="h-32 h1-32 m-0">
        <ul class="h-33 m-1">
          <li class="active">全部通知</li>
        </ul>
        <div class="m-2">
          <ul class="n-1">
            <li v-for="(item,index) in noticeList " :key="index">
              <a href="javascript:;">
                <img class="n-2" :src="item.avatar" />
                <div class="n-3">
                  <div class="n-4">
                    <span class="n-5">{{item.nickName}}</span>
                    <span class="n-6">{{item.createTime}}</span>
                  </div>
                  <div class="n-7">{{item.noticeContent}}</div>
                </div>
              </a>
            </li>
          </ul>
        </div>
        <div class="a-35 h-48">
          <mo-paging
            :page-index="currentPage"
            :total="totalPage"
            :page-size="pageSize"
            @change="pageChange"
          ></mo-paging>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import moment from "moment";
import http from "@/api/home";
import MoPaging from "@/views/Page";
export default {
  name: "myNews",
  components: {
    MoPaging,
  },
  data() {
    return {
      pageSize: 10, //每页显示20条数据
      totalPage: 1, //总记录数
      currentPage: 1, //作品与项目挂牌当前页码
      noticeList: Array,
    };
  },
  methods: {
    // 下一页
    pageChange(e) {
      this.currentPage = e;
      this.GetnoticeList();
    },
    // 获取系统公告
    GetnoticeList() {
      var datas = `noticeType=1&pageNum=${this.currentPage}&pageSize=10`;
      http.noticeList(datas).then((res) => {
        if (res.code == 200) {
          this.totalPage=res.total
          this.noticeList = res.rows;
        }
      });
    },
  },
  created() {
    this.GetnoticeList();
  },
  filters: {
    Time(value) {
      return moment(value).format("YYYY-MM-DD");
    },

    projectType(value) {
      let arr = [
        "图书",
        "期刊",
        "杂志",
        "报纸",
        "电影",
        "电视剧",
        "网剧",
        "综艺",
        "脱口秀",
        "纪录片",
        "专题片",
        "动漫",
        "少儿",
        "MTV",
        "演唱会",
      ];
      return arr[value];
    },
  },
};
</script>

<style scoped>
@import "../../layui/css/layui.css";
@import "../../css/index.css";
@import "../../css/user_listing.css";
@import "../../css/user_info.css";
@import "../../css/user_news.css";
@import "../../css/idangerous.swiper.css";
</style>